import request from '@/utils/request'

// 查询考试管理列表
export function listExam(query) {
  return request({
    url: '/module/exam/list',
    method: 'get',
    params: query
  })
}

// 查询考试管理详细
export function getExam(examCode) {
  return request({
    url: '/module/exam/' + examCode,
    method: 'get'
  })
}

// 新增考试管理
export function addExam(data) {
  return request({
    url: '/module/exam',
    method: 'post',
    data: data
  })
}

// 修改考试管理
export function updateExam(data) {
  return request({
    url: '/module/exam',
    method: 'put',
    data: data
  })
}

// 删除考试管理
export function delExam(examCode) {
  return request({
    url: '/module/exam/' + examCode,
    method: 'delete'
  })
}

//根据考试编号修改试卷是否发布
//传入参数 examCode,isPublish
export function releaseExam(params) {
  return request({
    url: '/module/exam/releaseExam',
    method: 'put',
    params
  })
}

//通过考试编号获取试卷题列表
export function getPaperQuestionList(params) {
  return request({
    url: '/module/exam/paper' ,
    method: 'get',
    params
  })  
}

//添加试题到试卷
//传入参数    
    // examCode:
    // judgeQuestionIds:
    // multiQuestionIds:
    // fillQuestionIds:
export function addQuestion(data) {
  return request({
    url: '/module/exam/addQuestionToPaper',
    method: 'post',
    data
  })
}

//在试卷中删除试题,传数组
//传入参数    
    // examCode:
    // judgeQuestionIds:
    // multiQuestionIds:
    // fillQuestionIds:
export function delQuestion(data) {
  return request({
    url: `/module/exam/delQuestion`,
    method: 'delete',
    data
  })
}

